package org.one.servlet.impl;


import org.one.servlet.OneRequest;
import org.one.servlet.OneResponse;
import org.one.servlet.OneServlet;

/**
 * Servlet规范的默认实现
 * 注意：不能放在中文目录下！
 */
public class DefaultOneServlet extends OneServlet {
    @Override
    public void doGet(OneRequest request, OneResponse response) throws Exception {
        // http://localhost:8080/aaa/bbb/userservlet?name=xiong
        // path：/aaa/bbb/userservlet?name=xiong
        String uri = request.getUri();
        response.write("404 - no this servlet : " + (uri.contains("?")?uri.substring(0,uri.lastIndexOf("?")):uri));
    }


    @Override
    public void doPost(OneRequest request, OneResponse response) throws Exception {
        doGet(request, response);
    }
}
